/**
 * Created by pkd on 14-5-21.
 */

var CONFIG = module.exports;

CONFIG.GM_DB = {
    host: 'rds154paodan.mysql.rds.aliyuncs.com',
    // host: 'rm-wz92v803r0075wy47.mysql.rds.aliyuncs.com',
    port: '3306',
    user: 'user_center',
    password: 'PlDpiVmhpJmm8NUb',
    database: 'user_center',
    connectionLimit: 100
};

CONFIG.GM_USUZ_DB = {
    host: 'rds154paodan.mysql.rds.aliyuncs.com',
    // host: 'rm-wz92v803r0075wy47.mysql.rds.aliyuncs.com',
    port: '3306',
    user: 'usuz',
    password: 'yuRKPTr52J07SSA7',
    database: 'usuz',
    connectionLimit: 100,
    charset:'utf8mb4',
};

CONFIG.RDS_PORT = 6379;
CONFIG.RDS_HOST = 'r-wz9adb359192d284.redis.rds.aliyuncs.com';
CONFIG.RDS_PWD = 'llc2017YYT';
CONFIG.RDS_OPTS = {};
CONFIG.TokenRedisDb = 6;

CONFIG.PDHost = '127.0.0.1:7000';      // 172.18.176.152
CONFIG.PD = 'http://pd.htaoke.com';
CONFIG.USUZHost = '127.0.0.1:9000';    // 172.18.176.152
CONFIG.USUZ_KEY = 'usuz';

CONFIG.JPUSH_CONFIG = {
    appkey:             "",
    masterSecret:       "",
    production:         0                               // 0 - 开发环境 ， 1 － 生产环境
};

CONFIG.isDebugMode = true;
CONFIG.isStartBackgroundTask = false;

// 验证码
CONFIG.SMS_AccessKeyId = 'LTAILhMtQnZ3rIrS';
CONFIG.SMS_AccessKeySecret = 'S2fdD1QFrSmvmh29fkefnEG98c8I7F';


CONFIG.NEW_TAOCOMMISSION_RATIO = [
    {
        self:0.50,//消费者自得返利
        reference1: 0.1,       //消费者消费，一级推荐人正常获得返利
        reference2: 0.0,       //消费者消费，二级推荐人正常获得返利
        agent_1:0,
        agent_2:0.05,           //消费者消费，省代正常获得返利
        agent_3:0.00,
        agent_4:0.08,           //消费者消费，区代正常获得返利
        agent_5:0,
        agent_6:0.09,
        elite:0.00,             //精英微淘客多得返利，从省代获利中拿,加部分
        elite_plus:1.00,         //精英微淘客多得返利，乘部分
        tax:0.9,
    },
    {
        reference1:0.25,
        reference2:0.0,
        agent_1:0,
        agent_2:0.075,
        agent_3:0,
        agent_4:0.10,
        agent_5:0,
        agent_6:0.10,
        elite:0.00,                 //精英微淘客多得返利，从分公司获利中拿
        elite_plus:1.00,             //精英微淘客多得返利，乘部分
        // elite_buy:0.50,          //购买精英微淘客，其推荐人直接获利比例(精英、区、市、省才有)
    },
    {
        reference1:0.00,
        reference2:0.0,
        agent_1:0,
        agent_2:0.075,
        agent_3:0,
        agent_4:0.15,
        agent_5:0,
        agent_6:0.25,
        elite:0.00,                 //精英微淘客多得返利，从分公司获利中拿
        elite_plus:1.00,             //精英微淘客多得返利，乘部分
        // elite_buy:0.50,          //购买精英微淘客，其推荐人直接获利比例(精英、区、市、省才有)
    }
];

CONFIG.calcCommission = function calcCommission(pay_amount, lvlName, isElite, ratioObj) {
    if(!ratioObj) return 0;
    var realRatio = ratioObj[lvlName];
    if(isElite){
        realRatio = ratioObj.elite_plus * (realRatio + ratioObj.elite)
    }
    var totalMoney = pay_amount * realRatio;
    return totalMoney;
}

CONFIG.isSpecialElite = function isSpecialElite(ratioObj) {
    if(ratioObj.elite != 0 || ratioObj.elite_plus != 1) return true;
    return false;
}

CONFIG.specialMoneyElite = function specialMoneyElite(money, originalCommission, ratioObj) {
    var totalMoney = parseFloat(money) + parseFloat(originalCommission * ratioObj.elite);
    if(ratioObj.elite_plus != 1) totalMoney = totalMoney * ratioObj.elite_plus;
    return totalMoney;
}


CONFIG.USUZ_COMPANY_UID = 749;

CONFIG.USUZ_COMPANY_ACCOUNT = 15659229000;


CONFIG.WXAuth = {
    'usuz' : {
        AppID: 'wx4d057f1eab51ac90',
        AppSecret: '0470628fb343e72897803818098ddb56'
    },
    'usuz_mob' : {
        AppID: 'wx64345905298ef424',
        AppSecret: 'ab9e366dcf783206e50643ec3636cb20',
    },
    'duoke' : {
        AppID: 'wx340788dd56f08729',
        AppSecret: '8122f80425ee14777226625f40edae02'
    },
    'duoke_program' : {
        AppID: 'wxa9c21c49e91715d9',
        AppSecret: 'cdbf163d2095a058ab3fb0bbae6ab1a7'
    }
}

CONFIG.BALANCE_CHANGE_TIME = '2017-12-15';

CONFIG.APR_ACTIVITY_TIME = '2018-04-13 12:18:00';

CONFIG.FWS_IS_FIRST_VIP = false;
CONFIG.FWS_SELF_RECOMMAND = true;
CONFIG.IS_CASH_LIMIT = true;  //是否有提现的限制

CONFIG.ALLOW_UPGRADE_AGENT = false;     // '已有服务商，无法修改'
CONFIG.MAX_AGENT_LEVEL = 6;

CONFIG.JNTB_ACCOUNT = 13606063939; //判断金牛合作手机号

CONFIG.TAOKE_ACCOUNT = 18650675557; //合作淘客手机号

CONFIG.TIME_COMMISSION_COEFFICIENT = {
    time1:'2018-05-11 00:00:00',
    coefficient1:0.2,
    time2:'2018-07-20 00:00:00',
}
